package cn.edu.scau.cmi.liuxintong;

import java.util.Iterator;

import cn.edu.scau.cmi.liuxintong.interProgramming.GraduateStudent;
import cn.edu.scau.cmi.liuxintong.interProgramming.UndergraduateStudent;
import javafx.application.Application;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.effect.DropShadow;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class InterProgrammingClient extends Application{
	 TextArea textArea = new TextArea();
	//new GraduateStudent().learning();
		//new UndergraduateStudent().learning();
	public static void main(String[] args) {
		 launch(args);
	}

	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		AnchorPane anchorPane = new AnchorPane();
		DropShadow dropshadow = new DropShadow();
		dropshadow.setColor(Color.PALEVIOLETRED);
		dropshadow.setOffsetX(5.0);
		dropshadow.setOffsetY(5.0);
		dropshadow.setRadius(10.0);
		Text experimentName = new Text("接口编程实验");//ok
		experimentName.setEffect(dropshadow);
		experimentName.setFont(Font.font(" Verdana",FontPosture.ITALIC,40));
		TextField textField = new TextField();
		textArea.setPrefHeight(330);
		textArea.setPrefWidth(780);
		 Button GraduateStudent = new Button("研究生");
		  Button UndergraduateStudent = new Button("本科生");
		  GraduateStudent.setOnAction(new EventHandler() {
		  public void handle(Event event) {
		  textArea.appendText(new GraduateStudent().learning()+"\n");
		  }});
		  UndergraduateStudent.setOnAction(new EventHandler() {
			  public void handle(Event event) {
			  textArea.appendText(new UndergraduateStudent().learning()+"\n");
			  }});
		  anchorPane.getChildren().addAll(experimentName,textField,textArea,GraduateStudent,UndergraduateStudent);
	     AnchorPane.setLeftAnchor(experimentName, 275.0);
		 AnchorPane.setBottomAnchor(experimentName,400.0);//下
		 AnchorPane.setLeftAnchor(textField, 140.0);
		 AnchorPane.setLeftAnchor(GraduateStudent,200.0);
		 AnchorPane.setBottomAnchor(GraduateStudent,350.0);//下
		 AnchorPane.setLeftAnchor( UndergraduateStudent, 450.0);
		 AnchorPane.setBottomAnchor( UndergraduateStudent,350.0);//下
		 AnchorPane.setBottomAnchor(textField,470.0);//下
		 AnchorPane.setLeftAnchor(textArea, 10.0);
		 AnchorPane.setBottomAnchor(textArea,10.0);
		 primaryStage.setScene(new Scene(anchorPane, 800,450));
	     primaryStage.show();
	}
}
